-- hurt_more_by_someone
-- created by dengc
-- 死亡后给BOSS附加上属性826（低语之森BOSS小怪专用）
-- BOSS受到{2}攻击时，损失{3}%生命值，持续{4}轮

return {
    apply = function(prop, baseValue)
        return math.modf(baseValue * prop[3] / 1000);
    end,

    -- 死亡后触发
    trigger = function(who, prop, arg)
        -- 找到boss
        local pos = DungeonBossM.getBossPos();
        local grid = DungeonM.getGridByPos(pos);
        local monster = grid.monster;

        if who.type ~= OBJECT_TYPE_MONSTER then
            return;
        end

        -- 如果是自己，直接return
        if monster:getClassId() == who:getClassId() then
            return;
        end

        if monster and not monster:isDead() then
            -- 附加上状态
            local effectRound = CombatM.getRound() + prop[4];
            local arr = ({ prop[1], prop[2], prop[3], effectRound, });

            local condition = {
                ["prop"]      = arr,
                ["end_round"] = effectRound,
            }

            -- 附加枯萎状态
            CombatStatusM.applyStatus(monster, "withered", condition);

            -- 抛出赋予DEBUF的事件
            EventMgr.fire(event.BOSS_RECIEVE_DEBUF, { ["skillId"] = "default", ["pos"] = DungeonBossM.getBossPos(), });

        end
    end,

    record = function(target, prop, path)
        return false;
    end
};